<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<script type="text/javascript">
	$(document).ready(function() {
		$.formValidator.initConfig({
			formid: "myform",
			autotip: true,
			onerror: function(msg, obj) {
				window.top.art.dialog({
					content: msg,
					lock: true,
					width: '200',
					height: '50'
				})
			}
		});
		$("#name").formValidator({
			onshow: "<?php echo L('input').L('contest_award_name')?>",
			onfocus: "<?php echo L('input').L('contest_award_name')?>"
		}).inputValidator({
			min: 1,
			onerror: "<?php echo L('input').L('contest_award_name')?>"
		});

		$("#guest").formValidator({
			onshow: "<?php echo L('input').L('contest_guest')?>",
			onfocus: "<?php echo L('input').L('contest_guest')?>"
		}).inputValidator({
			min: 1,
			onerror: "<?php echo L('input').L('contest_guest')?>"
		});




	});
</script>
<div class="pad-10">

	<form name="myform" action="?m=contest&c=award&a=edit" method="post"
		  id="myform" enctype="multipart/form-data">
		<input type="hidden" name="data[contest_id]" value="<?=$data['contest_id']?>">

		<input type="hidden" name="id" value="<?=$id?>">
		<div class="content pad-10" id="show_div_1" style="height: auto">
			<fieldset>
				<legend><?php echo L('contest_award_info')?></legend>
				<table width="100%" class="table_form">
					<tr>
						<td width="120"><?php echo L('contest_award_name')?>：</td>
						<td><input type="text" name="data[name]" id="name"
								   class="input-text"   value="<?= isset($data['name'])?$data['name']:""?>"  /></td>
					</tr>


					<tr>
						<td width="120"><?php echo L('contest_award_type')?>：</td>
						<td>
							<select name="data[type]">
								<?php
								foreach ($this->award_type as $k=>$v) {
									?>
									<option value="<?php echo $k;?>"
										<?php if($k==$data['type']){ echo "selected";}?>
										>
										<?php echo $v?>
									</option>
									<?php
								}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td width="120"><?php echo "嘉宾"?>：</td>
					<td >
						<input type="text" id="guest" class="input-text" name="data[guest]"  size="30" value="<?=$data['guest']?>"  />
						<?php echo form::select_default($guest,$data['guest_id'],'name="data[guest_id]" id="guest_id" ','请选择嘉宾')?>
						<script>

							$('#guest_id').change(function(){
								var select=$(this).children('option:selected').val();
								if(select!=""){
									var name=$(this).children('option:selected').html();
									$("#guest").val(name);

							})

						</script>

					</td>


					<tr>
						<td width="120"><?php echo '奖项横向图'?>：</td>

						<td><?php echo form::images('data[image_horizontal]', 'image_horizontal',isset($data['image_horizontal'])?$data['image_horizontal']:"", 'contest', '', 40)?></td>
					</tr>

					<tr>
						<td width="120"><?php echo '奖项纵向图'?>：</td>

						<td><?php echo form::images('data[image_vertical]', 'image_vertical',isset($data['image_vertical'])?$data['image_vertical']:"", 'contest', '', 40)?></td>
					</tr>

					<tr>
						<td width="120"><?php echo L('contest_award_image_square')?>：</td>

						<td><?php echo form::images('data[image_square]', 'image_square', isset($data['image_square'])?$data['image_square']:"", 'contest', '', 40)?></td>
					</tr>

					<tr>
						<td width="120"><?php echo L('contest_award_description')?>：</td>
						<td><textarea rows="10" cols="80" name="data[description]"
									  id="description"><?php if(isset($data['description']) ) { echo $data['description'];}?></textarea>
						</td>
					</tr>


				</table>
			</fieldset>


		</div>
		<div class="bk15"></div>




		<input type="submit" class="dialog" id="dosubmit" name="dosubmit"
			   value="<?php echo L('submit')?>" />

	</form>

</div>
</body>
</html>